<?php
/**
 *      [迷你云] (C)2009-2012 南京恒为网络科技.
 *   软件仅供研究与学习使用，如需商用，请访问www.miniyun.cn获得授权
 * 
 */
?>
<?php

class Option extends CMiniyunModel
{
	
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	
	public function tableName()
	{
		return Yii::app()->params['tablePrefix'].'options';
	}

    
    public function rules()
    {
                        return array(
            array('option_name', 'required'),
        );
    }

    
    public function relations()
    {
                        return array(
        );
    }

    
    public function attributeLabels()
    {
        return array(
            'id' => 'ID',
            'username' => 'Username',
            'password' => 'Password',
            'email' => 'Email',
        );
    }

    
    public function search()
    {
                
        $criteria=new CDbCriteria;

        $criteria->compare('id',$this->id);
        $criteria->compare('username',$this->username,true);
        $criteria->compare('password',$this->password,true);
        $criteria->compare('email',$this->email,true);

        return new CActiveDataProvider($this, array(
            'criteria'=>$criteria,
        ));
    }
    
    public function getMailSettingOptions(){
    	return $this->findAll("option_name like 'mail_%'");
    }
    
    public function getAppOptions(){
    	return $this->findAll("option_name like 'app_%'");
    }
}